package elephant.util;

/**
 * 
 * @author icecooly
 *
 */
public class StringUtil {

	public static boolean isEmpty(String input){
		if(input==null||input.length()==0){
			return true;
		}
		return false;
	}
	
	/**左边补0*/
	public static String lpad(int number,int length){
		return String.format("%0"+length+"d", number);   
	}
	/**
	 * 保留digits位小数(最后一位四舍五入)
	 * @param value
	 * @param dotNum
	 * @return
	 */
	public static final String numberFormat(double value,int digits){
		return String.format("%."+digits+"f",value);
	}
	//
	public static void main(String[] args) {
		System.out.println(lpad(1234,8));
		System.out.println(Integer.valueOf("0000102"));
		System.out.println(numberFormat(3.1415926, 3));
	}
}
